<% page_title "New Build" %>

<%= breadcrumb @project, "Build" %>

<section>
  <%= form_for [@project, @build], html: { class: "form-horizontal" } do |form| %>
    <%= render 'shared/errors', object: @build %>

    <%= form.input :git_ref, label: 'Git Reference' do %>
      <div id="scrollable-dropdown-menu">
        <%= form.text_field :git_ref, class: "form-control", autofocus: true, placeholder: "e.g. v2.1.43, master, fa0b4671", data: { prefetch_url: project_references_path(@project, format: "json") } %>
      </div>

      <div id="ref-problem-warning" class="alert alert-warning hidden">
        <p>There is currently a problem registered by a CI service for this Tag or SHA. Are you sure you wish to create a build?</p>
        <ul id="ref-problem-list"></ul>
      </div>
    <% end %>

    <%= form.input :dockerfile, input_html: {placeholder: 'Dockerfile'} %>
    <%= form.input :image_name %>
    <%= form.input :name %>
    <%= form.input :description, input_html: {row: 3} %>

    <%= Samson::Hooks.render_views(:build_new, self, form: form) %>

    <%= form.actions %>
  <% end %>
</section>
